home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / Include / rpcHistogram.h < prev    next >
C/C++ Source or Header  |  1990-10-02  |  3KB  |  81 lines

  1. /*
  2.  * rpcHistogram.h --
  3.  *
  4.  *    Definitions for the histograms of event durations.
  5.  *
  6.  * Copyright (C) 1985 Regents of the University of California
  7.  * All rights reserved.
  8.  *
  9.  *
  10.  * $Header: /sprite/src/kernel/rpc/RCS/rpcHistogram.h,v 9.2 90/10/02 16:29:32 mgbaker Exp $ SPRITE (Berkeley)
  11.  */
  12.  
  13. #ifndef _RPCHISTOGRAM
  14. #define _RPCHISTOGRAM
  15.  
  16. #include <spriteTime.h>
  17. #ifdef KERNEL
  18. #include <sync.h>
  19. #else
  20. #include <kernel/sync.h>
  21. #endif /* KERNEL */
  22.  
  23. /*
  24.  * An empirical time distribution is kept in the following structure.
  25.  * This includes the average, plus an array of calls vs. microseconds
  26.  * with some granularity on the time for each bucket.
  27.  */
  28. typedef struct Rpc_Histogram {
  29.     Sync_Lock lock;        /* Used to monitor access to histogram */
  30.     int numCalls;        /* The total number of calls */
  31.     Time aveTimePerCall;    /* The average interval duration */
  32.     Time totalTime;        /* The total time spent in the calls */
  33.     Time overheadTime;        /* Overhead cost per call */
  34.     int    usecPerBucket;        /* The granularity of the histogram */
  35.     int numHighValues;        /* Count of out-of-bounds values */
  36.     int bucketShift;        /* Used to map from time to bucket */
  37.     int numBuckets;        /* The number of slots in the histogram */
  38.     int *bucket;        /* The array of counters */
  39. } Rpc_Histogram;
  40.  
  41. /*
  42.  * This is the size of all the histograms kept by the system.
  43.  * Although they could vary in size, one size is used in order to
  44.  * simplify the interface to the user program that prints out
  45.  * the histograms.
  46.  */
  47. #define RPC_NUM_HIST_BUCKETS 50
  48. /*
  49.  * The service time is measured on both the client and the server.
  50.  * These flags enable/disable this measurement.  The macros are used
  51.  * to invoke the tracing procedures, subject to the flags.
  52.  */
  53. extern Boolean rpcServiceTiming;
  54. extern Boolean rpcCallTiming;
  55.  
  56. #define RPC_CALL_TIMING_START(command, timePtr) \
  57.     if (rpcCallTiming) { \
  58.     Rpc_HistStart(rpcCallTime[command], timePtr); \
  59.     }
  60. #define RPC_CALL_TIMING_END(command, timePtr) \
  61.     if (rpcCallTiming) { \
  62.     Rpc_HistEnd(rpcCallTime[command], timePtr); \
  63.     }
  64. #define RPC_SERVICE_TIMING_START(command, timePtr) \
  65.     if (rpcServiceTiming) { \
  66.     Rpc_HistStart(rpcServiceTime[command], timePtr); \
  67.     }
  68. #define RPC_SERVICE_TIMING_END(command, timePtr) \
  69.     if (rpcServiceTiming) { \
  70.     Rpc_HistEnd(rpcServiceTime[command], timePtr); \
  71.     }
  72.  
  73. extern Rpc_Histogram *Rpc_HistInit _ARGS_((int numBuckets, int usecPerBucket));
  74. extern void Rpc_HistReset _ARGS_((register Rpc_Histogram *histPtr));
  75. extern void Rpc_HistStart _ARGS_((register Rpc_Histogram *histPtr, register Time *timePtr));
  76.  extern void Rpc_HistEnd _ARGS_((register Rpc_Histogram *histPtr, register Time * timePtr));
  77. extern ReturnStatus Rpc_HistDump _ARGS_((register Rpc_Histogram *histPtr, register Address buffer));
  78. extern void Rpc_HistPrint _ARGS_((register Rpc_Histogram *histPtr));
  79.  
  80. #endif /* _RPCHISTOGRAM */
  81.